﻿using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using XLua;

public class ReadLuaFile : MonoBehaviour
{

    // Use this for initialization
    void Start()
    {
        LuaEnv luaEnv = new LuaEnv();
        luaEnv.DoString(MyLuaLoader("test"));

        luaEnv.Dispose();

    }

    private byte[] MyLuaLoader(string filePath)
    {
        string absPath = Application.streamingAssetsPath + "/" + filePath + ".lua";
        return System.Text.Encoding.UTF8.GetBytes(File.ReadAllText(absPath));
    }
}
